

<template>
	<view>
		<view class="list" v-for="item in dataList" @click="goexamination(item)">
				<view class="title">{{ item.plugsPracticeSubject.subjectName }}</view>
				<view class="title2" v-if="item.testStatus==1" >{{ item.accuracy }}%</view>
				<view class="title1">{{ item.plugsPracticeTestPaper.testPaperName }} <text class="tex" v-if="item.testType==1">（闭卷考试）</text><text class="tex"  v-if="item.testType==0">（开卷考试）</text></view>
				<view class="name">
							练习编号:
							<text>{{item.testNo}}</text>
				</view>
				<view class="line">
					
				</view>
				<view class="lianxi" >
					<view class="left" v-if="item.testStatus==0">
						练习中
					</view>
					<view class="left1" v-else>
						练习结束
					</view>
					<view class="right">{{ item.endTime }}</view>
				</view>
		</view>

		<view class="none_list_box" v-if="dataList.length === 0" style="margin-top: 200rpx;"><uv-empty mode="data" text="暂无考试记录"></uv-empty></view>
	</view>
</template>

<script>
import {getStudentPracticeTestRecordList,searchPlugsPracticeTestRecordById} from '../../../utils/api.js'
export default {
	data() {
		return {
			dataList: [],
			recordList: [],
			bankList: [],
			tatol: 0,
			startPage: 1
		};
	},
	onShow() {
		this.getlist();
	},
	computed: {
		// 结果统计
	},
	onReachBottom() {
		if (this.dataList.length < this.total) {
			this.startPage++;
			this.getlist();
		}
	},
	methods: {
		getlist() {
			let postdata = {
				page: this.startPage,
				studentId: uni.getStorageSync('studentInfo').id
			};
			getStudentPracticeTestRecordList(postdata).then(res => {
				if (res.code == 200) {
					if (this.startPage == 1) {
						this.dataList = [];
					}
					let arr = [];
					arr = this.dataList.concat(res.body.list);
					console.log(arr);
					this.dataList = arr;
					console.log(this.dataList);
					this.total = res.body.total;

					
				}
			});
		},
		goexamination(item) {
			
			uni.navigateTo({
						url: `/pages/user/testList/testReslut?dataId=${item.id}&contentId=${item.plugsPracticeTestPaper.id}&accuracy=${item.accuracy}`
					});
		},

		
	}
};
</script>

<style lang="scss">
page {
	background-color: #f5f5f5;
	padding: 20rpx;
	box-sizing: border-box;
}
.list {
	// display: flex;
	// align-items: center;
	// justify-content: space-between;
	padding: 20rpx 30rpx;
	border-bottom: 1rpx solid #f5f5f5;
	background-color: #fff;
	margin-bottom: 20rpx;
	border-radius: 20rpx;
	position: relative;
	overflow: hidden;
		.title {
			position: absolute;
			left: 0;
			top: 0;
			background-color: #fa7f26;
			color: #fff;
			font-weight: 700;
			font-size: 24rpx;
			padding:10rpx 30rpx;
			border-radius: 0 0 20rpx 0;
		}
		.title2 {
			position: absolute;
			right: 0;
			top: 0;
			// background-color: #fa7f26;
			color: #e44032;
			font-weight: 700;
			font-size: 24rpx;
			padding:10rpx 30rpx;
			border-radius: 0 0 20rpx 0;
		}
		.title1{
			color: #000;
			font-weight: 700;
			font-size: 30rpx;
			margin-top: 50rpx;
			.tex{
				color: #999;
				font-weight: normal;
				font-size: 26rpx;
			}
		}
		.name {
			display: flex;
			align-items: center;
			padding: 10rpx 0;
			font-size: 24rpx;
			color: #666;
			text {
				margin-left: 5rpx;
			}
		}
		.line{
			width: 100%;
			height: 2rpx;
			background-color: #e8e8e8;
			margin: 10rpx 0;
		}
		.lianxi{
			display: flex;
			align-items: center;
			justify-content: space-between;
			font-size: 28rpx;
			.left{
				color: #fa7f26;
			}
			.left1{
				color: #5ac725;
			}
			.right{
				color: #666;
			}
		}
	
}
</style>

